<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="utf-8" %>
<%@taglib prefix="accessory" uri="http://accessoryPackageTag.weitu.net" %>
<%@taglib uri="http://workflowReviewTag.weitu.net" prefix="flow" %>
<!--工作流审批处理标签-->
<!doctype html>
<html lang="zh">
<head>
    <title>业务表单</title>
    <%@include file="/common/header.jspf" %>
    <script type="text/javascript">
        var loginUserName = '${loginUser.name}';
        var loginUserId = '${loginUser.id}'
    </script>
    <SCRIPT src="${ctx}/resources/js/accidentEvent/accident/verify.js" type="text/javascript"></SCRIPT>
    <style>
        .flow_review {

            width: 100%;
            margin-bottom: 20px;
        }

        .flow_review .review_title {
            width: 100px;
            text-align: right;
        }

        .flow_review > table {
            width: 100%;
        }

        .flow_review label {
            float: left;
            width: 50px;
        }

        .flow_review label > input {
            width: 10px;
        }

        .flow_review textarea {
            width: 80%;
        }

        .flow_review .review_next_check {
            width: 100%;
        }

        /*.flow_review .review_result{
            padding-left:20%;
            height:30px;
            line-height:30px;
        }
        .flow_review .review_result>label{
            width:50px;
            float:left;
        }
        .flow_review .review_result>label>input{
            width:10px;
        }
        .flow_review  .review_comments{
            height:auto;
        }
        .flow_review  .review_comments>textarea{
            margin-left:10%;
            width:80%;
        }*/
    </style>
</head>
<body>
<div class="menu-right" style="">
    <a class="button icon-save" id="btn_save">
        保存
    </a>
    <%-- <a class="button icon-refer" id="">
        提交
    </a>--%>
    <%--<a class="button icon-export">
        导入
    </a>--%>
</div>
<form id="infoForm" method="post">
    <input type="hidden" name="id" value="${info.id}">
    <div class="information">
        <div class="information-title">
            <p>事故基本信息</p>
            <a class="panel-down" href="javascript:void(0)">
                <span style="color: #49A9F9" class="fa fa-chevron-down fa-lg"></span>
            </a>
        </div>
        <div class="cuttle" style="">
            <div style="clear: both">
                <div class="form_one" style="">
                    <label class="lable-style">事故名称:</label>
                    <input type="text" class="easyui-textbox" style="width: 240px;" required="true" name="name"
                           value="${info.name}" readonly>
                    <span>*</span>
                </div>
                <div class="form_one">
                    <label class="lable-style">事故发生单位:</label>
                    <input id="happenDeptId" class="easyui-textbox" style="width: 240px;" required="true"
                           editable="false" validType="validSelect" name="happenDeptId" value="${info.happenDeptId}"
                           readonly>
                    <span>*</span>
                </div>
                <div class="form_one">
                    <label class="lable-style">事故发生时间:</label>
                    <input class="easyui-datebox" style="width: 240px;" editable="false" name="happenTime"
                           required="true" value="${info.happenTime}" readonly>
                    <span>*</span>
                </div>
            </div>
            <div style="clear: both">
                <div class="form_one" style="">
                    <label class="lable-style">事故级别:</label>
                    <input id="accidentLevelId" type="text" class="easyui-textbox" style="width:240px;" required="true"
                           editable="false" validType="validSelect" name="accidentLevelId"
                           value="${info.accidentLevelId}" readonly>
                    <span>*</span>
                </div>
                <div class="form_one" style="">
                    <label class="lable-style">事故类别:</label>
                    <input id="accidentTypeId" type="text" class="easyui-textbox" style="width:240px;" required="true"
                           editable="false" validType="validSelect" name="accidentTypeId"
                           value="${info.accidentTypeId}" readonly>
                    <span>*</span>
                </div>
                <div class="form_one" style="">
                    <label class="lable-style">项目名称:</label>
                    <input type="hidden" id="projectId" name="projectId" value="${info.projectId}">
                    <input id="project" type="text" class="easyui-textbox" style="width:240px;" required="true"
                           validType="validSelect"
                           editable="false" name="project" value="${info.projectName}" readonly>
                    <span>*</span>
                </div>
            </div>
            <div style="clear: both">
                <div class="form_one">
                    <label class="lable-style">是否选择工厂模式:</label>
                    <select class="easyui-combobox" style="width: 240px;" id="isFactoryModel" name="isFactoryModel"
                            editable="false" panelHeight="50" readonly>
                        <option value="1" <c:if test="${info.isFactoryModel eq 1}">selected</c:if>>是</option>
                        <option value="0" <c:if test="${info.isFactoryModel eq 0}">selected</c:if>>否</option>
                    </select>
                    <span>*</span>
                </div>
                <div class="form_one" id="siteIdDiv">
                    <label class="lable-style">事故发生地点:</label>
                    <input id="siteId" name="siteId" type="hidden" value="${info.siteId}">
                    <input id="site" name="site" editable="false" class="easyui-textbox" required="true"
                           validType="validSelect" style="width: 240px;" value="${info.siteIdName}" readonly>
                    <span>*</span>
                </div>
                <div class="form_one" id="siteNameDiv" style="display: none;">
                    <label class="lable-style">事故发生地点:</label>
                    <input id="siteName" name="siteName" class="easyui-textbox" required="true" style="width: 240px"
                           value="${info.siteName}" readonly>
                    <span>*</span>
                </div>
                <div class="form_one">
                    <label class="lable-style">具体部位:</label>
                    <input id="specificSite" name="specificSite" class="easyui-textbox" style="width: 240px;"
                           value="${info.specificSite}" readonly>
                </div>
            </div>
            <div style="clear: both">
                <div class="form_one">
                    <label class="lable-style">是否承包商事故:</label>
                    <select class="easyui-combobox" style="width: 240px;" id="isContractor" name="isContractor"
                            panelHeight="50" editable="false" readonly>
                        <option value="1" <c:if test="${info.isContractor eq 1}">selected</c:if>>是</option>
                        <option value="0" <c:if test="${info.isContractor eq 0}">selected</c:if>>否</option>
                    </select>
                    <span>*</span>
                </div>
                <div class="form_one">
                    <label class="lable-style">是否境外事故:</label>
                    <select class="easyui-combobox" style="width: 240px;" id="isOverseas" name="isOverseas"
                            panelHeight="50" editable="false" readonly>
                        <option value="1" <c:if test="${info.isOverseas eq 1}">selected</c:if>>是</option>
                        <option value="0" <c:if test="${info.isOverseas eq 0}">selected</c:if>>否</option>
                    </select>
                    <span>*</span>
                </div>
                <div class="form_one" id="contractorDiv" style="display: none;">
                    <label class="lable-style">承包商名称:</label>
                    <input id="contractorId" name="contractorId" type="hidden" value="${info.contractorId}">
                    <input id="contractor" editable="false" class="easyui-textbox" required="true"
                           validType="validSelect" style="width: 240px;" value="${info.contractorName}" readonly>
                    <span>*</span>
                </div>
            </div>
            <div style="clear: both;height:57px;">
                <div class="form_one">
                    <label class="lable-style">死亡人数:</label>
                    <input class="easyui-numberspinner" style="width: 240px;" required="true" name="dieNum"
                           data-options="min:0" value="${info.dieNum}" readonly>
                    <span>*</span>
                </div>
                <div class="form_one">
                    <label class="lable-style">重伤人数:</label>
                    <input class="easyui-numberspinner" style="width: 240px;" required="true" name="seriousInjuryNum"
                           data-options="min:0" value="${info.seriousInjuryNum}" readonly>
                    <span>*</span>
                </div>
                <div class="form_one">
                    <label class="lable-style">轻伤人数:</label>
                    <input class="easyui-numberspinner" style="width: 240px;" required="true" name="slightInjuryNum"
                           data-options="min:0" value="${info.slightInjuryNum}" readonly>
                    <span>*</span>
                </div>
            </div>
            <div style="clear: both">
                <div class="form_one fotm-textarea" style="margin-bottom: 5px;">
                    <label class="lable-style">事故经过:</label>
                    <input class="easyui-textbox" data-options="multiline:true" required
                           style="height: 50px;width: 598px;" name="course" value="${info.course}" readonly>
                    <span>*</span>
                </div>
            </div>
            <div style="clear: both">
                <div class="form_one fotm-textarea" style="margin-bottom: 5px;">
                    <label class="lable-style">事故初步原因:</label>
                    <input class="easyui-textbox" data-options="multiline:true" required
                           style="height: 50px;width: 598px;" name="firstReason" value="${info.firstReason}" readonly>
                    <span>*</span>
                </div>
            </div>
            <div style="clear: both">
                <div class="form_one fotm-textarea" style="margin-bottom: 5px;">
                    <label class="lable-style">事故处理情况:</label>
                    <input class="easyui-textbox" data-options="multiline:true" required
                           style="height: 50px;width: 598px;" name="handleCondition" value="${info.handleCondition}"
                           readonly/>
                    <span>*</span>
                </div>
            </div>
            <div style="clear: both;">
                <div class="form_one">
                    <label class="lable-style">报告单位:</label>
                    <input class="easyui-textbox" id="reportDeptId" style="width: 240px;" required="true"
                           name="reportDeptId" editable="false"
                           value="${info.reportDeptId}" readonly/>
                    <span>*</span>
                </div>
                <div class="form_one">
                    <label class="lable-style">报告人:</label>
                    <input type="hidden" id="reportUserId" name="reportUserId" value="${info.reportUserId}">
                    <input id="reportUser" class="easyui-textbox" style="width: 240px;" required="true" editable="false"
                           value="${info.reportUserName}" readonly/>
                    <span>*</span>
                </div>
                <div class="form_one">
                    <label class="lable-style">报告时间:</label>
                    <input class="easyui-datebox" style="width: 240px;" required="true" name="reportTime"
                           editable="false" value="${info.reportTime}" readonly/>
                    <span>*</span>
                </div>
            </div>
            <div style="clear: both;height:57px;">
                <div class="form_one">
                    <label class="lable-style">事故主管部门:</label>
                    <input class="easyui-textbox" id="competentDeptId" style="width: 240px;" required="true"
                           name="competentDeptId" value="${info.competentDeptId}" readonly/>
                    <span>*</span>
                </div>
                <div class="form_one">
                    <label class="lable-style">安全监督管理部门负责人:</label>
                    <input type="hidden" id="safetyDeptDutyUserId" name="safetyDeptDutyUserId"
                           value="${info.safetyDeptDutyUserId}">
                    <input id="safetyDeptDutyUser" class="easyui-textbox" style="width: 240px;" required="true"
                           value="${info.safetyDeptDutyUserName}" readonly/>
                    <span>*</span>
                </div>
                <div class="form_one">
                    <label class="lable-style">公司分管领导:</label>
                    <input type="hidden" id="chargeLeaderId" name="chargeLeaderId" value="${info.chargeLeaderId}">
                    <input id="chargeLeader" class="easyui-textbox" style="width: 240px;" required="true"
                           value="${info.chargeLeaderName}" readonly/>
                    <span>*</span>
                </div>
            </div>
        </div>
    </div>
    <div class="information">
        <div class="information-title">
            <p>事故相关附件</p>
            <a class="panel-down" href="javascript:void(0)">
                <span style="color: #49A9F9" class="fa fa-chevron-down fa-lg"></span>
            </a>
        </div>
        <div class="cuttle" style="margin-bottom: 20px;">
            <accessory:accessorySimple permission="" packageKey="sgfj" uploadUserId="${loginUser.id}"
                                       packageInfos="${accessoryList}"
                                       accessoryType="txt,docx,doc,xls,xlsx,jpg,png"></accessory:accessorySimple>
        </div>

    </div>
</form>
<%--审核信息--%>
<form id="verifyForm">
    <input type="hidden" name="businessId" value="${info.id}">
    <input type="hidden" name="workItemId" value="${workItemId}"/>
    <input type="hidden" name="step" value="${step}"/>
    <div class="information" style="">
        <div class="information-title">
            <p>审批信息</p>
            <a href="#"><img src="${ctx}/resources/themes/images/alias_03.png" width="18"></a>
        </div>
        <div class="input-wrap">
            <!--工作流审批意见-->
            <flow:review requestName="workflowReview" workItemId="${workItemId}"/>
        </div>
    </div>
</form>
</body>
<script type="text/javascript">
    $(function () {
        /***
         * 审批操作
         */
        $('#btn_save').on("click", function () {

            $.messager.progress();	// 显示进度条
            var data = $("#verifyForm").serializeJson();
            if (!checkVerifyResult('workflowReview')) {
                $.messager.progress('close');
                return false;
            }
            //表单提交
            $('#verifyForm').form('submit', {
                url: ROOT_PATH + '/accidentEvent/accident/verifyApplication.shtml',
                data: data,
                onSubmit: function (param) {
                    return true;	// 返回false终止表单提交
                },
                success: function (result) {
                    try {
                        result = $.parseJSON(result);
                    } catch (e) {
                        $.messager.progress('close');
                        parent.layer.msg(result.message, {time: 1000, icon: 2});
                    }
                    if (result.success) {
                        $.messager.progress('close');	// 如果提交成功则隐藏进度条
                        parent.layer.msg(result.message, {time: 1000, icon: 1}, function () {
                            WindowManager.closeLayer();//关闭窗口
                        });
                    } else {
                        $.messager.progress('close');	// 如果提交失败则不做处理
                        parent.layer.msg(result.message, {time: 1000, icon: 2});
                    }
                }
            });
        });
    });
</script>
</html>
